<!DOCTYPE html>
<!--
  ~ Date：11/11/18 11:01 AM 
  ~ Author: guomw
  ~
  -->

<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title>我的订单</title>

    <link rel="stylesheet" href="http://cdn.viptool.cn/lib/bootstrap/3.3.5/css/bootstrap.min.css">
    <link href="../../resource/hotui/css/font-awesome.min.css" th:href="@{/resource/hotui/css/font-awesome.min.css}" rel="stylesheet">
    <!-- Morris -->
    <link href="http://cdn.viptool.cn/lib/morris.js/0.4.3/morris.css" rel="stylesheet">
    <link href="http://cdn.viptool.cn/lib/animate.css/2.1.1/animate.min.css" rel="stylesheet">
    <link href="../../resource/hotui/css/style.min-1.0.8.css" th:href="@{/resource/hotui/css/style.min-1.0.8.css}" rel="stylesheet">
    <link href="../../resource/hotui/css/hotui.style.override.css" th:href="@{/resource/hotui/css/hotui.style.override.css}" rel="stylesheet"/>
    <!--checkbox-->
    <link href="http://cdn.viptool.cn/lib/awesome-bootstrap-checkbox/0.3.5/awesome-bootstrap-checkbox.min.css" rel="stylesheet">
    <!--datetimepick-->
    <link href="http://cdn.viptool.cn/lib/bootstrap-daterangepicker/2.1.25/daterangepicker.min.css" rel="stylesheet">
</head>
<body class="gray-bg">
<link href="http://cdn.viptool.cn/lib/bootstrap-daterangepicker/2.1.25/daterangepicker.min.css" rel="stylesheet">
<div class="wrapper wrapper-content animated fadeInRight tooltip-demo">
    <!--search-->
    <form role="form" id="searchForm" class="search-panel" method="get" th:object="${condition}">
        <div class="row">
            <div class="col-lg-12">
                <div class="ibox">
                    <div class="ibox-content">
                        <div class="form-inline">
                            <input type="hidden" th:value="${pageIndex}" name="pageIndex"/>
                            <div class="form-group m-r-sm">
                                <label class=" control-label" for="keyword">订单名称：</label>
                                <input type="text" class="form-control input-sm mb10" id="keyword" th:value="*{keyword}"
                                       name="keyword" placeholder="订单名称" style="width: 156px;"/>
                            </div>
                            <div class="form-group m-r-sm">
                                <label class=" control-label" for="keyword">订单类型：</label>
                                <select class="form-control input-sm" name="oderType" id="oderType">
                                    <option value="-1">所有</option>
                                    <option value="0">普单</option>
                                    <option value="">报单</option>

                                </select>
                            </div>
                            <div class="form-group m-r-sm">
                                <label class=" control-label" for="keyword">状态：</label>
                                <select class="form-control input-sm" name="orderStatus" id="orderStatus">
                                    <option value="-1">所有</option>
                                    <option th:each="status:${orderStatusList}" th:value="${status.code}"
                                            th:text="${status.desc}"
                                            th:selected="${status.code}==*{orderStatus}"></option>
                                </select>
                            </div>
                            <div class="form-group m-r-sm">
                                <label class=" control-label" for="keyword">订单号：</label>
                                <input type="text" class="form-control input-sm mb10" id="orderId"
                                       th:value="*{orderId}" name="orderId" placeholder="订单号" style="width: 156px;"/>
                            </div>
                        </div>
                        <p style="height: 8px;"></p>
                        <div class="form-inline">
                            <div class="form-group m-r-sm">
                                <label class=" control-label" for="createTimePick">下单时间：</label>
                                <input type="text" class="form-control input-sm mb10 data-range-pick"
                                       id="createTimePick" name="createTimePick" start-element="#beginTime"
                                       end-element="#endTime" placeholder="开始时间-结束时间" style="width: 277px;"/>
                                <input type="hidden" th:value="*{beginTime}" id="beginTime" name="beginTime"/>
                                <input type="hidden" th:value="*{endTime}" id="endTime" name="endTime"/>
                            </div>
                            <div class="form-group m-r-sm">
                                <button type="button" onclick="orderHandler.search(1)"
                                        class="btn btn-primary btn-sm m-b-none searchBtn">筛选
                                </button>
                                <button type="button" onclick="orderHandler.searchAll()"
                                        class="btn btn-primary btn-sm m-b-none">显示全部
                                </button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </form>
    <!--search-->
    <!--list-->
    <div class="row">
        <div class="col-lg-12">
            <div class="ibox float-e-margins m-b-none">
                <div class="tabs-container">
                    <div class="tab-content">
                        <div class="tab-pane active">
                            <div class="panel-body">
                                <table class="table table-bordered table-hover table-center">
                                    <thead>
                                    <tr>
                                        <th>订单编号</th>
                                        <th>账户信息</th>
                                        <th>订单名称</th>
                                        <th>订单类型</th>
                                        <th>金额</th>
                                        <th>添加时间</th>
                                        <th>发货状态</th>
                                        <th>支付状态</th>
                                        <th>收货信息</th>
                                        <th>快递信息</th>
                                        <th>操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <!--/*@thymesVar id="row" type="com.shengtang.stagent.data.entity.OrdersPO"*/-->
                                    <tr th:each="row,index:${orders}">
                                        <td th:text="${row.orderId}">123123</td>
                                        <td>
                                            <span th:text="|${row.user.realName}(${row.user.userLevelPO.levelName})|">王明(大区经理)</span>
                                            <br/>
                                            <span th:text="${row.user.username}">17678767675</span>
                                            <br/>
                                            <span th:text="${row.user.idcardNo}">33098988787676</span>
                                        </td>
                                        <td th:text="${row.tostr}"></td>
                                        <td th:text="${row.leagueOrder==true?'报单':'普单'}">1211</td>
                                        <td th:text="${row.finalAmount}">1211</td>
                                        <td th:text="${#temporals.format(row.createTime,'yyyy-MM-dd HH:mm:ss')}"></td>
                                        <td>
                                            <span class="color-primary" th:text="${row.getStatusDesc()}">已结算</span>
                                        </td>
                                        <td>
                                            <span class="color-primary" th:text="${row.payStatus==1?'已支付':'未支付'}">已支付</span>
                                        </td>
                                        <td>
                                            <span th:text="|${row.shipName}(${row.shipMobile})|">王明(13000000000)</span>
                                            <br>
                                            <span th:text="${row.shipAddr}"></span>
                                        </td>
                                        <td>
                                            <span th:text="|${row.expressCompanyName}(${row.expressNo})|"></span>
                                        </td>
                                        <td>
                                            <!--<button onclick="orderHandler.optDetails('123')"-->
                                            <!--th:onclick="|orderHandler.optDetails('${row.orderId}')|" type="button"-->
                                            <!--class="btn btn-primary btn-xs m-b-none">发货-->
                                            <!--</button>-->
                                            <button onclick="orderHandler.optDetails('123')"
                                                    th:onclick="|orderHandler.optDetails('${row.orderId}')|" type="button"
                                                    class="btn btn-white btn-xs m-b-none">查看详情
                                            </button>
                                        </td>
                                    </tr>
                                    </tbody>
                                </table>
                                <p style="float: left; margin: 20px 0;">
                                    共<span th:text="${totalRecords}"></span>条记录，当前第<span th:text="${pageIndex}"></span>/<span
                                        th:text="${totalPages==0?1:totalPages}"></span>，每页20条记录
                                </p>
                                <ul style="float: right;" class="pagination pagination-split">
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!--list-->
</div>
<script src="http://cdn.viptool.cn/lib/jquery/2.2.4/jquery.min.js"></script>
<script src="http://cdn.viptool.cn/lib/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<script src="../../resource/hotui/js/hot/bootstrap.hot.extra-utils.js?20190316" th:src="@{/resource/hotui/js/hot/bootstrap.hot.extra-utils.js?20190316(123123)}"></script>
<script src="../../resource/hotui/js/hot/bootstrap.hot.extra-init.js?20190316"></script>
<script src="../../resource/hotui/js/content.min.js" th:src="@{/resource/hotui/js/content.min.js}"></script>

<!--日期选择-->
<script src="http://cdn.viptool.cn/lib/moment.js/2.19.2/moment.min.js"></script>
<script src="../../resource/hotui/js/plugins/datetimepick/js/daterangepicker.js" th:src="@{/resource/hotui/js/plugins/datetimepick/js/daterangepicker.js}"></script>
<!--file-->
<script src="../../resource/hotui/js/plugins/prettyfile/bootstrap-prettyfile.js"></script>

<script src="../../resource/hotui/js/plugins/SearchableSelect/jquery.searchableSelect.js"></script>


<script>
    const pageIndex = /*[[${pageIndex}]]*/  1;
    const totalPages = /*[[${totalPages}]]*/  0;
    const pageUri = /*[[@{/delivery/order/list}]]*/  "";
    const orderDetailUri = /*[[@{/delivery/order/detail}]]*/  "";

    $(function () {
        //初始化分页
        var pageinate = new hotUtil.paging(".pagination", pageIndex, totalPages, 7);
        pageinate.init(function (p) {
            orderHandler.search(p);
        });
        $(document).keyup(function (event) {
            if (event.keyCode == 13) {
                $(".searchBtn").trigger("click");
            }
        });
    });

    var orderHandler = {
        search: function (pageIndex) {
            $("input[name=pageIndex]").val(pageIndex);
            $("#searchForm").submit();
        },
        searchAll: function () {
            window.location.reload();
        },
        optDetails: function (orderId) {
            hotUtil.newTab(orderDetailUri + "?orderId=" + orderId, "订单详情" + orderId);
        }
    }

</script>
</body>
</html>